package org.jix.weblog.module.common.utils;

import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author Jix
 * @Date 2024/7/14 17:26
 * @version 1.0
 * @注释
 */
@Slf4j
public class JsonUtil {
    private static final ObjectMapper INSTANCE =  new ObjectMapper();
    public static String toJsonString(Object obj) {
        try {
            return INSTANCE.writeValueAsString(obj);
        } catch (Exception e) {
            return obj.toString();
        }
    }
}
